﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
	<ResourceDictionary.MergedDictionaries>
		<ResourceDictionary Source="Brushes.xaml"/>
	</ResourceDictionary.MergedDictionaries>
	<!-- Resource dictionary entries should be defined here. -->
	<ControlTemplate x:Key="ImageButtonTemplate" TargetType="{x:Type Button}">
		<Grid>
			<Grid HorizontalAlignment="Stretch" x:Name="NormalState">
				<Rectangle VerticalAlignment="Stretch" Fill="{DynamicResource MainBrush}" StrokeThickness="0" RadiusX="3" RadiusY="3" x:Name="rectangle"/>
				<Rectangle Stroke="{DynamicResource OutsideEdge}" RadiusX="{Binding Path=RadiusX, ElementName=rectangle, Mode=Default}" RadiusY="{Binding Path=RadiusY, ElementName=rectangle, Mode=Default}"/>
			</Grid>
			<Grid HorizontalAlignment="Stretch" x:Name="HoverState" Visibility="Hidden" RenderTransformOrigin="0.5,0.5">
				<Rectangle VerticalAlignment="Stretch" Fill="{DynamicResource MainBrushLight}" StrokeThickness="0" RadiusX="{Binding Path=RadiusX, ElementName=rectangle, Mode=Default}" RadiusY="{Binding Path=RadiusY, ElementName=rectangle, Mode=Default}"/>
				<Rectangle Stroke="{DynamicResource OutsideEdge}" RadiusX="{Binding Path=RadiusX, ElementName=rectangle, Mode=Default}" RadiusY="{Binding Path=RadiusY, ElementName=rectangle, Mode=Default}"/>
			</Grid>
			<Grid HorizontalAlignment="Stretch" x:Name="PressedState" Visibility="Hidden">
				<Rectangle VerticalAlignment="Stretch" Fill="{DynamicResource MainBrushDark}" StrokeThickness="0" RadiusX="{Binding Path=RadiusX, ElementName=rectangle, Mode=Default}" RadiusY="{Binding Path=RadiusY, ElementName=rectangle, Mode=Default}"/>
				<Rectangle Stroke="{DynamicResource InsideEdge}" RadiusX="{Binding Path=RadiusX, ElementName=rectangle, Mode=Default}" RadiusY="{Binding Path=RadiusY, ElementName=rectangle, Mode=Default}"/>
			</Grid>
            <Grid Margin="{TemplateBinding Padding}" >
                <ContentPresenter HorizontalAlignment="Stretch" VerticalAlignment="Stretch"  Margin="{Binding Path=Margin, ElementName=contentPresenter, Mode=Default}" x:Name="contentPresenter">
                </ContentPresenter>
            </Grid>
		</Grid>
		<ControlTemplate.Triggers>
			<Trigger Property="IsMouseOver" Value="True">
				<Setter Property="Visibility" TargetName="HoverState" Value="Visible"/>
				<Setter Property="RenderTransformOrigin" TargetName="HoverState" Value="0.5,0.5"/>
			</Trigger>
			<Trigger Property="IsPressed" Value="True">
				<Setter Property="Visibility" TargetName="PressedState" Value="Visible"/>
			</Trigger>
		</ControlTemplate.Triggers>
	</ControlTemplate>
    <Style x:Key="ImageButton" TargetType="{x:Type Button}">
		<Setter Property="Padding" Value="3,3,3,3"/>
        <Setter Property="Template" Value="{StaticResource ImageButtonTemplate}"/>
    </Style>
</ResourceDictionary>